<script setup>
import { RouterView } from 'vue-router'
import UserHeader from '@/components/UserHeader.vue';
</script>

<template>
  <UserHeader></UserHeader>
  <div class="full-screen-bg">
    <div class="user-center-container">
      <div class="flex-layout">

        <div class="sidebar">
          <el-aside class="left_menu">
            <el-menu :default-active="$route.path" active-text-color="#e6a23c" router>
              <el-menu-item index="/user-center/profile">
                <i class="iconfont icon-user"></i>
                <span>个人资料</span>
              </el-menu-item>
              <el-menu-item index="/user-center/settings">
                <i class="iconfont icon-settings"></i>
                <span>账号设置</span>
              </el-menu-item>
            </el-menu>
          </el-aside>
        </div>

        <div class="main-content-wrapper">
          <el-main class="main-content">
            <RouterView />
          </el-main>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.full-screen-bg {
  background-color: #fff;
  min-height: 100vh;

  .user-center-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
  }
}

.flex-layout {
  display: flex;
  gap: 20px;

  .sidebar {
    flex-shrink: 0;
    width: 190px;

    :deep(.left_menu) {
      width: 100% !important;
      min-height: 300px;
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

      .el-menu {
        border-radius: 8px;
        padding: 8px 0;
        border-right: 0px;

        .el-menu-item {
          height: 48px;
          margin: 4px 8px;
          transition: all 0.3s;
          border-radius: 10px;

          &:hover {
            background: #f1f3f5;
          }

          &.is-active {
            color: #1677ff;
            background: #e6f4ff;
            font-weight: 500;
          }

          i {
            margin-right: 12px;
            font-size: 18px;
          }
        }
      }
    }
  }

  .main-content-wrapper {
    flex: 1;
    min-width: 0; // 防止内容溢出

    .main-content {
      background: white;
      padding: 24px;
      border-radius: 8px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
      min-height: calc(100vh - 100px);
    }
  }
}
</style>